#!/bin/bash
# {{ ansible_managed }}

{% for item in cert_supported_services %}
echo "stopping service {{ item.name }} via {{ item.sp }}"
{% if item.sp == 'docker' %}
docker stop {{ item }}
{% elif item.sp == 'os' and ansible_service_mgr == 'systemd' %}
systemctl stop {{ item }}
{% elif item.sp == 'os' and ansible_service_mgr == 'upstart' %}
initctl stop {{ item }}
{% elif item.sp == 'os' and ansible_service_mgr == 'openrc' %}
rc-service {{ item }} stop
{% elif item.sp == 'os' %}
service {{ item }} stop
{% endif %}
{% endfor %}